from typing import *


class Solution:
    def isZeroArray(self, nums: List[int], queries: List[List[int]]) -> bool:
        n = len(nums)
        dp = [0] * (n + 1)
        for l, r in queries:
            dp[l] += 1
            dp[r + 1] -= 1
        tot = 0
        for i, v in enumerate(nums):
            tot += dp[i]
            if tot < v:
                return False
        return True
